import ui
import ui.component as uic
// import gg

const win_width = 800
const win_height = 600

fn main() {
	window := ui.window(
		width:          win_width
		height:         win_height
		title:          'V UI: File Browser'
		native_message: false
		mode:           .resizable
		layout:         uic.filebrowser_stack(
			id:              'fb'
			on_click_ok:     on_click_ok
			on_click_cancel: on_click_cancel
		)
	)
	ui.run(window)
}

fn on_click_ok(b &ui.Button) {
	println(uic.filebrowser_component(b).selected_full_title())
}

fn on_click_cancel(b &ui.Button) {
	if b.ui.dd is ui.DrawDeviceContext {
		b.ui.dd.quit()
	}
}
